This invention relates to an electronic digital computer and, more particularly, to a system for executing Prolog programs, namely, programs written in a programming language referred to in the art as Prolog (PROgramming in LOGic).
As will later be exemplified with reference to one of several figures of the accompanying drawing, a Prolog program is written as a sequence of clauses. For example, a clause is written as follows to describe that Jack likes fruits: EQU Likes(Jack, *things).rarw.Fruits(*things). (1)
In a clause, a dash with an arrowhead.rarw.is a logic symbol. The expressions on both sides of the logic symbol are called predicates, respectively. The word exemplified by "likes" and "fruits" are referred to herein as predicate names, respectively. The words "Jack" and "*things" are called arguments, respectively. The argument preceded by an asterisk * is a variable argument. The argument without the asterisk is a constant argument.
Each predicate represents an event and is defined by a predicate name and a permutation of one or more arguments. As will become clear as the description proceeds, it is important to direct attention to the order in which the arguments are arranged in a predicate. The word "permutation" is therefore used even when there is only one argument in a predicate.
The lefthand side of the logic symbol is called a head and the righthand side, a body. A clause may have only either the head or the body. A clause having both the head and the body, is called a regular clause. A clause having only the head, is called a declaratory clause. The head of each declaratory clause need not be followed by the logic symbol but directly by a stop. A clause having the body alone, is named an interrogatory clause. In each interrogatory clause, the body should be preceded by the logic symbol.
The predicate of the head and the predicate of the body are herein called a head predicate and a body precicate. The head of a regular or a declaratory clause consists of only one head predicate. It is therefore possible to refer to a head also as a head predicate. The body of a regular or an interrogatory clause consists of one or more body predicates. When a body consists of N predicates, a comma is interposed between two adjacent ones of the body predicates as: EQU Predicate H.rarw.Predicate 1, Predicate 2, . . . , Predicate N. (2)
In Clause (2), "Predicate H" represents a certain head predicate. "Predicate 1" through "Predicate N" represent body predicates, N in number. The comma used between the body predicates, is another logic symbol which means AND. Stated otherwise, the event represented by the head predicate is true only when all events represented by "Predicate 1" through "Predicate N" hold. Incidentally, it is possible to understand that a declaratory clause has zero body predicate and that an interrogatory clause, zero head predicate.
Let it be assumed that there is another clause in addition to Clause (1) such that: EQU Fruits(strawberry). (3)
A sequence of Clauses (1) and (3) represents by the syllogistic deduction that Jack likes strawberry.
It is possible to execute a Prolog program by a conventional computer. Moreover, a higher-grade machine is known in the art, which is of an architecture capable of dealing with various programming languages. There is, however, no machine known which is effectively operable to execute Prolog programs.